package com.tencreat.mall.controller.common;

/**
 * 其他公共接口控制器
 *
 * @author zixin
 * @company 深圳腾创互联科技有限公司
 * @link https://tencreat.com
 * @since 2023/4/13 14:04
 */

import com.tencreat.common.core.HttpResult;
import com.tencreat.service.system.ISysDictDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/mall/common/other")
@Api(tags = "其他公共接口")
@RequiredArgsConstructor
public class OtherController {

    private final ISysDictDataService sysDictDataService;

    @ApiOperation("获取字典数据（适合下拉框等场景）")
    @GetMapping("/dict-data/{dictType}")
    HttpResult<List<Map<String, String>>> dictData(@PathVariable String dictType) {
        return HttpResult.ok(sysDictDataService.getObjectDataByType(dictType));
    }

}
